package zaphod.toy.gef.japanexample.editpolicies;

import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;

import zaphod.toy.gef.japanexample.model.command.ChangeConstraintCommand;


public class MyXYLayoutEditPolicy extends XYLayoutEditPolicy
{

    @Override
    protected Command createChangeConstraintCommand( EditPart child,
            Object constraint )
    {
        // TODO Auto-generated method stub
        return null;
    }


    @Override
    protected Command createChangeConstraintCommand(
            ChangeBoundsRequest request, EditPart child, Object constraint )
    {
        ChangeConstraintCommand command;

        command = new ChangeConstraintCommand();
        command.setModel( child.getModel() );
        command.setConstraint( (Rectangle)constraint );

        return command;
    }


    @Override
    public Command getCommand( Request request )
    {
        System.out.println( request.getType() );
        return super.getCommand( request );
    }


    @Override
    protected Command getCreateCommand( CreateRequest request )
    {
        // TODO Auto-generated method stub
        return null;
    }

}
